#define DEBUG
#include <cstdio>
#define MAXN 300000

using namespace std;

int max(int a, int b) {
  return a>b ? a : b ;
}

int main() {
#ifdef DEBUG
  freopen("3176.in", "r", stdin);
  freopen("3176.out", "w", stdout);
#endif

  static bool book[MAXN+1];
  static int h[MAXN+1];
  int n, k, tot=0, maxd=0;
  scanf("%d %d", &n, &k);
  for (int i=1; i<=n; i++) {
    scanf(" %d ", h+i);
  }
  for (int i=1; i<=n; i++) {
    char c=getchar();
    if (c=='T') {
      if (!book[i]) {
	book[i]=true;
	tot++;
	int j;
	for (j=i-1; j>0 && h[j]>=h[j+1] && !book[j]; j--) {
	  book[j]=true;
	  tot++;
	}
	for (j=i+1; j<=n && h[j]>=h[j-1] && !book[j]; j++) {
	  book[j]=true;
	  tot++;
	}
      }
    }
  }

  if (!book[k]) {
    int i, temp1, temp2;
    for (i=k-1; i>0 && h[i]<=h[i+1] && !book[i]; i--);
    temp1=k-i;
    for (i=k+1; i<=n && h[i]<=h[i-1] && !book[i]; i++);
    temp2=i-k;
    if (h[k]==h[k+1] && h[k]==h[k-1]) {
      maxd=temp1+temp2-1;
    } else {
      maxd=max(temp1, temp2);
    }
    printf("%d", maxd);
  } else {
    for (int i=1, j; i<=n; i++) {
      for (; i<=n && book[i]; i++);
      if (i<=n) {
	for (j=i+1; j<=n && h[j]<=h[j-1]; j++);
	maxd = max(maxd, j-i);
	i=j;
      }
    }
    for (int i=n, j; i>0; i--) {
      for (; i>0 && book[i]; i--);
      if (i>0) {
	for (j=i-1; j>0 && h[j]<=h[j+1]; j--);
	maxd = max(maxd, i-j);
	i=j;
      }
    }
    printf("%d", tot+maxd);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
